package com.example.check_oa.model.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.comment_oa.pojos.attendance.HolidayAp;
import com.example.check_oa.model.service.HolidayApService;
import com.example.check_oa.model.mapper.HolidayApMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
* @author cjl
* @description 针对表【holiday_ap】的数据库操作Service实现
* @createDate 2022-10-22 14:10:05
*/
@Service
public class HolidayApServiceImpl extends ServiceImpl<HolidayApMapper, HolidayAp>
    implements HolidayApService{
    @Resource
    HolidayApMapper holidayApMapper;

    @Override
    public int yesHoli(String hoId, String yesUser) {
        UpdateWrapper<HolidayAp> wrapper=new UpdateWrapper<>();
        wrapper.eq("ho_water",hoId);
        HolidayAp holidayAp=new HolidayAp();
        holidayAp.setHoYesUser(yesUser);
        holidayAp.setHoApYesTime(new Date());
        holidayAp.setHoState(1);
        return holidayApMapper.update(holidayAp,wrapper);
    }

    @Override
    public int noHoli(String hoId, String yesUser) {
        UpdateWrapper<HolidayAp> wrapper=new UpdateWrapper<>();
        wrapper.eq("ho_water",hoId);
        HolidayAp holidayAp=new HolidayAp();
        holidayAp.setHoYesUser(yesUser);
        holidayAp.setHoApYesTime(new Date());
        holidayAp.setHoState(2);
        return holidayApMapper.update(holidayAp,wrapper);
    }
}




